<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>{$info.title}-{$user_info['nickname']}-树人号</title>
    <link href="__STATIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__STATIC__/weibo/css/style.css" rel="stylesheet">
    <script type="text/javascript" src="__STATIC__/admin/js/jquery.min.js"></script>
    <script type="text/javascript" src="__STATIC__/weibo/js/jquery.json.js"></script>
    <script type="text/javascript" src="__STATIC__/admin/js/layer/layer.js" ></script>
    <link rel="stylesheet" href="__STATIC__/style/weui.min.css">
    <link rel="stylesheet" href="__STATIC__/style/cmgd.css">



    <style>
        .content1{padding:10px;}
        .weui-media-box__hd img{height:100%;}
        .title{width:100%;font-size:22px; font-weight: bold;}
        .title1{width:100%;font-size:14px; color: #ccc;padding: 8px 0;}
        .zan{ margin:0 auto; height:30px; line-height:30px;text-align: center; }
        .num{height: 30px; line-height:30px;float:left;}
        .pl{padding-left:20%}
        .foot{width:100%; position: fixed;height:40px; bottom: 0;background:#fff;line-height:40px;}
        .footli{width:100%;float:left;text-align:center;line-height:40px;padding: 0; margin: 0 auto;}
        .fleft{float: left; text-align: center;}
        .fleft a {width:40px;height:30px;}
        .pinglun{background:#00a0e9; color:#fff;}
        a{ text-decoration:none;}
        .comm{width: 100%;padding-top: 10px; margin-bottom: 10px;}
        .c_img{float: left;width: 15%;margin: 0 auto;text-align: center;padding-top: 20px;}
        .p1{height: 25px;line-height: 25px; padding: 0;margin: 0;font-size:12px;}
        .p2{line-height: 25px;padding: 0;margin: 0;font-size:12px;}
        .p3{height: 25px;line-height: 25px;padding: 0;margin: 0;font-size:12px; padding-bottom: 15px;}
        .c_left{float: left;width: 85%;}
        .weui-tabbar__i{font-family: "Microsoft Yahei";}
        #zan{font-size:16px;width: 50px;padding-top:7px;}
        #collect{font-size:16px;width:60px;padding-top:7px;}
        #xpl{font-size:16px;width:60px;padding-top:7px;}
        .biaoti{border-bottom:1px #ccc solid; font-size:16px; line-height:30px;height:30px;}
        .newtitle{color:#000;font-size:14px;font-weight: 100;}
        .newtitle1{color:#000;font-size:14px;font-weight: 100;}
        .weui-btn_default{background:#969696; color:#fff;}
        .fa-thumbs-up{color:#2fab87;}
        .fa-heart{color:#2fab87;}
    </style>
</head>
<body style="background:#F7F7F7;">
<div id="content" class="content" >
    <div class="content1">
    <div><img src="/uploads/images/{$info.photo}" width="100%"></div>


        <div class="weui-cells">

            <div class="weui-cell weui-cell_access">
                <div class="weui-cell__bd">
                    <span style="vertical-align: middle">标题:{$info.title}</span>
                </div>
            </div>
            <div class="weui-cell weui-cell_access">
                <div class="weui-cell__bd">
                    <span style="vertical-align: middle">征文对象:{$info.object_people}</span>
                </div>
            </div>
            <div class="weui-cell weui-cell_access">
                <div class="weui-cell__bd">
                    <span style="vertical-align: middle">截至时间:{$info.end_time}</span>
                </div>
            </div>


        </div>

        <div class="weui-panel weui-panel_access">
            <div class="weui-panel__bd">
                <div class="weui-media-box weui-media-box_text">
                    <h4 class="weui-media-box__title">内容：</h4>
                    <p class="weui-media-box__desc">{$info.content}</p>
                </div>
            </div>
        </div>


        <div class="weui-panel weui-panel_access">
            <div>作者信息：</div>
            <div class="weui-panel__bd">

                <a href="{:url('user/user_info',array('user_id'=>$user_info['id']))}" class="weui-media-box weui-media-box_appmsg">
                    <div class="weui-media-box__hd">
                        <img class="weui-media-box__thumb" src="/uploads/face/{$user_info['head_img']}" alt="">
                    </div>
                    <div class="weui-media-box__bd">
                        <h4 class="weui-media-box__title">{$user_info['nickname']}</h4>
                        <p class="weui-media-box__desc">{$user_info['desc']}</p>
                    </div>
                </a>
            </div>
        </div>



        <div class="weui-cells">
            <div id="comment_list" style="margin-top: 10px;">
                <div class="weui-media-box__title" style="padding-left: 10px;">参与征文记录</div>

                <div id="pingluns">


                </div>
                <div style="height: 60px;">
                    &nbsp; &nbsp; &nbsp;
                </div>
            </div>
            <div style="height: 60px;">&nbsp;</div>
            </div>
        </div>


    <div class="weui-tabbar footer" id="foot">
        <a href="javascript:;" class="weui-tabbar__item" onclick="dianzan({$info.id});" style=" border-right:1px #ccc solid;" >
                    <span style="display: inline-block;position: relative;vertical-align: middle;">
                            <i id="zan" class="fa {if condition='$is_zan eq 1'}fa-thumbs-up{else}fa-thumbs-o-up{/if} ">&nbsp;&nbsp;赞</i>
                        </span>

            <!--<p class="weui-tabbar__label" id="zan1">{$zan}</p>-->
        </a>
        <a href="javascript:;" class="weui-tabbar__item" onclick="shoucang({$info.id});" >

                   <span style="display: inline-block;position: relative;vertical-align: middle;">
                            <i id="collect" class="fa {if condition='$is_collect eq 1'}fa-heart{else}fa-heart-o{/if} ">&nbsp;&nbsp;收藏</i>
            </span>
            <!--<p class="weui-tabbar__label" id="collect1">收藏</p>-->

        </a>
        <a  href="javascript:;" class="weui-tabbar__item " onclick="pinglun({$user_id})" style=" border-left:1px #ccc solid;">


            <span style="display: inline-block;position: relative;vertical-align: middle;">
                            <i id="xpl" class="fa fa-comment-o weui-tabbar__icon">&nbsp;&nbsp;投稿</i>
        </span>
        </a>
    </div>








</div>


<div class="weui-tab" id="pinglun" style="display: none;" >
    <div class="weui-cells__title">请选择你投稿的文章：</div>
    <div class="weui-cells">
        <div class="weui-cell weui-cell_select">
            <div class="weui-cell__bd">

                <select class="weui-select" name="article_id" id="article_id">
                    <option value="0">请选择</option>
                    {foreach name="myarticle" item="val"}
                        <option value="{$val.id}">{$val.title}</option>
                    {/foreach}
                </select>
            </div>
        </div>
    </div>

    <div style="width:80%;margin:0 auto;padding-top: 30px;">
        <input type="hidden" name="essay_id" id="essay_id" value="{$id}">
        <input id="now" type="hidden" value="">
        <input type="hidden" name="user_id" id="user_id" value="{$user_id}">
        <a href="javascript:;" class="weui-btn weui-btn_primary" id="showTooltips">提交</a>

        <a href="javascript:;" class="weui-btn weui-btn_default" id="returnbutton" >返回</a>
    </div>
</div>




<script type="text/javascript">
    AjaxPage();
    $(window).scroll(
            function() {
                var scrollTop = $(this).scrollTop();
                var scrollHeight = $(document).height();
                var windowHeight = $(this).height();
                if (scrollTop + windowHeight == scrollHeight) {
                        AjaxPage();
                }
            });

   function AjaxPage(){
       var now =  $('#now').val();
       var article_id = '{$id}';
       if(now==''){
           now =1 ;
       }

           $.post('{:url("index/essay_article_list")}',
                   {id:article_id,page:now},
                   function(data){
                       if(data.code==1) {

                           // console.log(data.list[0].addtime);
                           $html = '';
                           for(c in data.list){


                               if(data.list[c].count>0){
                                   var vhtml = "<br><h5 class='weui-media-box__desc'><a class='newtitle1' href='/index/index/article_edit/id/"+data.list[c].article_eidt_id+".html'>"+data.list[c].article_eidt_title+"</a></h5><small class='weui-media-box__desc minTime'>"+data.list[c].update_time+"</small>"
                               }else{
                                   var vhtml ='';
                               }


                               //data.list[c].addtime
                               $html = $html + "<span  class='weui-media-box weui-media-box_appmsg'><div class='weui-media-box__hd'> <img class='weui-media-box__thumb' src='/uploads/images/"+data.list[c].photo+"' alt=''></div><div class='weui-media-box__bd'><h5 class='weui-media-box__desc newtitle'>"+data.list[c].title+"</h5><small class='weui-media-box__desc minTime'>"+data.list[c].add_time+"</small>"+vhtml+"</div></span>";
                           }

                           $("#pingluns").append($html);

                       }
                   });

           var next = now + 1;
           $('#now').val(next) ;

   }



   function pinglun(i){
       var qq = '{$can_tou}';
        if(qq==0){
            layer.msg('征文投稿时间已过，无法投稿!',{icon:5,time:1500,shade: 0.1,});
            return false;
        }


       if(i==0){
           layer.msg('您尚未登录！',{icon:5,time:1500,shade: 0.1,});
           window.location.href="{:url('user/login')}";
       }
       document.getElementById('content').style.display = 'none';
       document.getElementById('pinglun').style.display = 'block';
   }

   $('#returnbutton').on('click',function(){
       $('#pinglun').hide();
       $('#content').show();
   });

   $('#showTooltips').on('click', function(){
       var article_id = $('#article_id').val();
       var user_id = $('#user_id').val();
       var essay_id = $('#essay_id').val();
       if(article_id==0){
           layer.msg('请选择您要投稿的文章',{icon:5,time:1500,shade: 0.1,});
           return false;
       }


       $.post('{:url("index/essay_join")}',
               {essay_id:essay_id,user_id:user_id,article_id:article_id},
               function(data){
                   if(data.code==11){
                       layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                       window.location.href="{:url('user/login')}";
                   }else{
                       if(data.code==1) {

                          $html =  "<span  class='weui-media-box weui-media-box_appmsg'><div class='weui-media-box__hd'> <img class='weui-media-box__thumb' src='/uploads/images/"+data.list.photo+"' alt=''></div><div class='weui-media-box__bd'><h5 class='weui-media-box__desc'>"+data.list.title+"</h5><small class='weui-media-box__desc minTime'>"+data.list.add_time+"</small> </div></span>";

                          $("#pingluns").prepend($html);
                           $('#pinglun').hide();
                           $('#content').show();
                           layer.msg(data.msg,{icon:1,time:1500,shade: 0.1,});

                       }else{
                           layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                       }
                   }
               });

   });



    function dianzan(id){
        $.post('{:url("index/essay_zan_status")}',
                {id:id},
                function(data){
                    if(data.code==11){
                        layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                        window.location.href="{:url('user/login')}";
                    }else {
                        if(data.code==1){

                            $('#zan').removeClass('fa-thumbs-o-up');
                            $('#zan').addClass('fa-thumbs-up');


//                            $('#zan').attr('src','__STATIC__/index/images/zan.png') ;
//                            document.getElementById('zan1').innerHTML = data.count;
                            layer.msg(data.msg,{icon:1,time:1500,shade: 0.1,});
                        }else{
                            $('#zan').removeClass('fa-thumbs-up');
                            $('#zan').addClass('fa-thumbs-o-up');
//                            $('#zan').attr('src','__STATIC__/index/images/zan1.png') ;
//                            document.getElementById('zan1').innerHTML = data.count;
                            layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                        }
                    }

                });
    }
    function shoucang(id){
        $.post('{:url("index/essay_collect_status")}',
                {id:id},
                function(data){
                    if(data.code==11){
                        layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                        window.location.href="{:url('user/login')}";
                    }else{
                        if(data.code==1){
                            $('#collect').removeClass('fa-heart-o');
                            $('#collect').addClass('fa-heart');
                            layer.msg(data.msg,{icon:1,time:1500,shade: 0.1,});
                        }else{

                            $('#collect').removeClass('fa-heart');
                            $('#collect').addClass('fa-heart-o');
                            layer.msg(data.msg,{icon:5,time:1500,shade: 0.1,});
                        }
                    }
                });
    }





</script>


</body>
</html>